<?php
/**
 * 音效分类查询
 */
require_once dirname(dirname(__DIR__))."/common.php";
use app\cls\tom\Response;
use app\cls\tom\SysResource;
use app\model\UserVideo;
//实例化数据库
$db = SysResource::getDB(false);
$UserVideo=new UserVideo($db);
$res=$UserVideo->music_type();
if(!empty($res)){
    foreach($res as $k=>&$v){
        $res1=$UserVideo->music($v['id'],1,10);
        if(count($res1)<5){
            unset($res[$k]);
        }else{
            $v['children']=$res1;
        }
    }
    $da1=[];
    if(!empty($res)){
        foreach($res as $kk=>$vv){
            $da1[]=$vv;
        }
    }
    Response::output(0,"查询成功",$da1);
}else{
    Response::output(0,"查询成功",[]);
}










//if(!empty($res)){
//    Response::output(0,"查询成功",$res);
//}else{
//    Response::output(0,"查询成功",[]);
//}